/**
 * Created by dujiaheng on 2016/7/29.
 */
export function configRouter(router) {
    //单独功能路由
    var routeObj = {
        '/login': {
            component: require('./login/login.vue')
        },
        '/unitChoose/:storageName/:currentNode/:needRoot': {
            name: 'unitChoose',
            component: require('./components/UnitRadioChoose.vue'),
        },
        '/fullGraphics': {
            name: 'fullGraphics',
            component: require('./components/FullScreenGraphics.vue'),
        }
    }
    //首页功能路由
    Object.assign(routeObj, {
        '/home': {
            name: 'home',
            component: require('./index.vue'),
        },
        '/homeResult': {
            name: 'homeResult',
            component: require('./home/result.vue')
        },
    })

    Object.assign(routeObj, {
        'business': {
            name: 'business',
            component: require('./business/index.vue')
        }
    })


    router.map(routeObj)
    router.beforeEach(function () {
        window.scrollTo(0, 0)
    })

// 重定向根路径到 /home
    router.redirect({
        '/': '/home'
    })

}